package com.test;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/**
 * Created by zhaopeng on 2/17/17.
 */
public class ReadFileByLine {
    protected void beginReadFile(){

    }
    protected void doReadAction(String line) {
    }
    protected void doFileDone(){

    }
    public void readFile(String fileName) throws IOException{
        beginReadFile();
        File file = new File(fileName);
        BufferedReader reader;
        reader = new BufferedReader(new FileReader(file));
        String line = null;

        while ((line = reader.readLine()) != null) {
            doReadAction(line);
        }
        reader.close();
        doFileDone();
    }

}
